﻿<ResourceDictionary 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  
  xmlns:date_time="clr-namespace:System.Controls.DateTime"
  xmlns:controls="clr-namespace:System.Controls">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Common.xaml"/>
  </ResourceDictionary.MergedDictionaries>

  <sys:String x:Key="property">Months</sys:String>

  <ControlTemplate x:Key="controlTemplate" TargetType="date_time:MonthRadioGroup">

    <Border
      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
      CornerRadius="{TemplateBinding CornerRadius}"
      BorderBrush="{TemplateBinding BorderBrush}"
      BorderThickness="{TemplateBinding BorderThickness}"
      Background="{TemplateBinding Background}" 
      OpacityMask="{TemplateBinding OpacityMask}">

      <WrapPanel>

        <controls:RadioButton
			    IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=January}" 
			    Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=January}" 
          Foreground="{TemplateBinding Foreground}"  
          Margin="{TemplateBinding Padding}" />

        <controls:RadioButton
			    IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=February}" 
			    Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=February}" 
          Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}" />

        <controls:RadioButton
          Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=March}" 
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=March}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=April}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=April}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}"
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=May}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=May}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=June}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=June}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=July}"          
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=July}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=August}"          
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=August}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=September}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=September}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=October}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=October}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=November}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=November}" />

        <controls:RadioButton
			    Foreground="{TemplateBinding Foreground}" 
          Margin="{TemplateBinding Padding}"
          IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Months, Converter={StaticResource e2b}, ConverterParameter=December}"
          Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Culture, Converter={StaticResource c2mn}, ConverterParameter=December}" />

      </WrapPanel>

    </Border>

  </ControlTemplate>

  <Style x:Key="{x:Type date_time:MonthRadioGroup}" TargetType="date_time:MonthRadioGroup" BasedOn="{StaticResource {x:Type Control}}">
    <Setter Property="Focusable" Value="False" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Padding" Value="4"/>
    <Setter Property="Template" Value="{StaticResource controlTemplate}"/>
  </Style>

</ResourceDictionary>